generating function recurrence relation